home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / emacs-19.000 / emacs-19 / usr / local / info / emacs-19 < prev    next >
Encoding:
GNU Info File  |  1995-09-11  |  39.6 KB  |  939 lines

  1. This is Info file ../info/emacs, produced by Makeinfo-1.55 from the
  2. input file emacs.texi.
  3.  
  4. 
  5. File: emacs,  Node: Named ASCII Chars,  Next: Mouse Buttons,  Prev: Function Keys,  Up: Key Bindings
  6.  
  7. Named ASCII Control Characters
  8. ------------------------------
  9.  
  10.    TAB, RET, BS, LFD, ESC and DEL started out as names for certain
  11. ASCII control characters, used so often that they have special keys of
  12. their own.  Later, users found it convenient to distinguish in Emacs
  13. between these keys and the "same" control characters typed with the
  14. CTRL key.
  15.  
  16.    Emacs 19 distinguishes these two kinds of input, when used with the X
  17. Window System.  It treats the "special" keys as function keys named
  18. `tab', `return', `backspace', `linefeed', `escape', and `delete'.
  19. These function keys translate automatically into the corresponding
  20. ASCII characters *if* they have no bindings of their own.  As a result,
  21. neither users nor Lisp programs need to pay attention to the
  22. distinction unless they care to.
  23.  
  24.    If you do not want to distinguish between (for example) TAB and
  25. `C-i', make just one binding, for the ASCII character TAB (octal code
  26. 011).  If you do want to distinguish, make one binding for this ASCII
  27. character, and another for the "function key" `tab'.
  28.  
  29.    With an ordinary ASCII terminal, there is no way to distinguish
  30. between TAB and `C-i' (and likewise for other such pairs), because the
  31. terminal sends the same character in both cases.
  32.  
  33. 
  34. File: emacs,  Node: Mouse Buttons,  Next: Disabling,  Prev: Named ASCII Chars,  Up: Key Bindings
  35.  
  36. Rebinding Mouse Buttons
  37. -----------------------
  38.  
  39.    Emacs uses Lisp symbols to designate mouse buttons, too.  The
  40. ordinary mouse events in Emacs are "click" events; these happen when you
  41. press a button and release it without moving the mouse.  You can also
  42. get "drag" events, when you move the mouse while holding the button
  43. down.  Drag events happen when you finally let go of the button.
  44.  
  45.    The symbols for basic click events are `mouse-1' for the leftmost
  46. button, `mouse-2' for the next, and so on.  Here is how you can
  47. redefine the second mouse button to split the current window:
  48.  
  49.      (global-set-key [mouse-2] 'split-window-vertically)
  50.  
  51.    The symbols for drag events are similar, but have the prefix `drag-'
  52. before the word `mouse'.  For example, dragging the first button
  53. generates a `drag-mouse-1' event.
  54.  
  55.    You can also define bindings for events that occur when a mouse
  56. button is pressed down.  These events start with `down-' instead of
  57. `drag-'.  Such events are generated only if they have key bindings.
  58. When you get a button-down event, a corresponding click or drag event
  59. will always follow.
  60.  
  61.    If you wish, you can distinguish single, double, and triple clicks.
  62. A double click means clicking a mouse button twice in approximately the
  63. same place.  The first click generates an ordinary click event.  The
  64. second click, if it comes soon enough, generates a double-click event
  65. instead.  The event type for a double click event starts with
  66. `double-': for example, `double-mouse-3'.
  67.  
  68.    This means that you can give a special meaning to the second click at
  69. the same place, but it must act on the assumption that the ordinary
  70. single click definition has run when the first click was received.
  71.  
  72.    This constrains what you can do with double clicks, but user
  73. interface designers say that this constraint ought to be followed in
  74. any case.  A double click should do something similar to the single
  75. click, only "more so".  The command for the double-click event should
  76. perform the extra work for the double click.
  77.  
  78.    If a double-click event has no binding, it changes to the
  79. corresponding single-click event.  Thus, if you don't define a
  80. particular double click specially, it executes the single-click command
  81. twice.
  82.  
  83.    Emacs also supports triple-click events whose names start with
  84. `triple-'.  Emacs does not distinguish quadruple clicks as event types;
  85. clicks beyond the third generate additional triple-click events.
  86. However, the full number of clicks is recorded in the event list, so you
  87. can distinguish if you really want to.  We don't recommend distinct
  88. meanings for more than three clicks, but sometimes it is useful for
  89. subsequent clicks to cycle through the same set of three meanings, so
  90. that four clicks are equivalent to one click, five are equivalent to
  91. two, and six are equivalent to three.
  92.  
  93.    Emacs also records multiple presses in drag and button-down events.
  94. For example, when you press a button twice, then move the mouse while
  95. holding the button, Emacs gets a `double-drag-' event.  And at the
  96. moment when you press it down for the second time, Emacs gets a
  97. `double-down-' event (which is ignored, like all button-down events, if
  98. it has no binding).
  99.  
  100.    The variable `double-click-time' specifies how long may elapse
  101. between clicks that are recognized as a pair.  Its value is measured in
  102. milliseconds.  If the value is `nil', double clicks are not detected at
  103. all.  If the value is `t', then there is no time limit.
  104.  
  105.    The symbols for mouse events also indicate the status of the modifier
  106. keys, with the usual prefixes `C-', `M-', `H-', `s-', `A-' and `S-'.
  107. These always precede `double-' or `triple-', which always precede
  108. `drag-' or `down-'.
  109.  
  110.    A frame includes areas that don't show text from the buffer, such as
  111. the mode line and the scroll bar.  You can tell whether a mouse button
  112. comes from a special area of the screen by means of dummy "prefix
  113. keys."  For example, if you click the mouse in the mode line, you get
  114. the prefix key `mode-line' before the ordinary mouse-button symbol.
  115. Thus, here is how to define the command for clicking the first button in
  116. a mode line to run `scroll-up':
  117.  
  118.      (global-set-key [mode-line mouse-1] 'scroll-up)
  119.  
  120.    Here is the complete list of these dummy prefix keys and their
  121. meanings:
  122.  
  123. `mode-line'
  124.      The mouse was in the mode line of a window.
  125.  
  126. `vertical-line'
  127.      The mouse was in the vertical line separating side-by-side
  128.      windows.  (If you use scroll bars, they appear in place of these
  129.      vertical lines.)
  130.  
  131. `vertical-scroll-bar'
  132.      The mouse was in a vertical scroll bar.  (This is the only kind of
  133.      scroll bar Emacs currently supports.)
  134.  
  135.    You can put more than one mouse button in a key sequence, but it
  136. isn't usual to do so.
  137.  
  138. 
  139. File: emacs,  Node: Disabling,  Prev: Mouse Buttons,  Up: Key Bindings
  140.  
  141. Disabling Commands
  142. ------------------
  143.  
  144.    Disabling a command marks the command as requiring confirmation
  145. before it can be executed.  The purpose of disabling a command is to
  146. prevent beginning users from executing it by accident and being
  147. confused.
  148.  
  149.    An attempt to invoke a disabled command interactively in Emacs
  150. displays a window containing the command's name, its documentation, and
  151. some instructions on what to do immediately; then Emacs asks for input
  152. saying whether to execute the command as requested, enable it and
  153. execute it, or cancel.  If you decide to enable the command, you are
  154. asked whether to do this permanently or just for the current session.
  155. Enabling permanently works by automatically editing your `.emacs' file.
  156.  
  157.    The direct mechanism for disabling a command is to put a non-`nil'
  158. `disabled' property on the Lisp symbol for the command.  Here is the
  159. Lisp program to do this:
  160.  
  161.      (put 'delete-region 'disabled t)
  162.  
  163.    If the value of the `disabled' property is a string, that string is
  164. included in the message printed when the command is used:
  165.  
  166.      (put 'delete-region 'disabled
  167.           "It's better to use `kill-region' instead.\n")
  168.  
  169.    You can make a command disabled either by editing the `.emacs' file
  170. directly or with the command `M-x disable-command', which edits the
  171. `.emacs' file for you.  Likewise, `M-x enable-command' edits `.emacs'
  172. to enable a command permanently.  *Note Init File::.
  173.  
  174.    Whether a command is disabled is independent of what key is used to
  175. invoke it; disabling also applies if the command is invoked using
  176. `M-x'.  Disabling a command has no effect on calling it as a function
  177. from Lisp programs.
  178.  
  179. 
  180. File: emacs,  Node: Keyboard Translations,  Next: Syntax,  Prev: Key Bindings,  Up: Customization
  181.  
  182. Keyboard Translations
  183. =====================
  184.  
  185.    Some keyboards do not make it convenient to send all the special
  186. characters that Emacs uses.  The most common problem case is the DEL
  187. character.  Some keyboards provide no convenient way to type this very
  188. important character--usually because they were designed to expect the
  189. character `C-h' to be used for deletion.  On these keyboard, if you
  190. press the key normally used for deletion, Emacs handles the `C-h' as a
  191. prefix character and offers you a list of help options, which is not
  192. what you want.
  193.  
  194.    You can work around this problem within Emacs by setting up keyboard
  195. translations to turn `C-h' into DEL and DEL into `C-h', as follows:
  196.  
  197.      ;; Translate `C-h' to DEL.
  198.      (keyboard-translate ?\C-h ?\C-?)
  199.      
  200.      ;; Translate DEL to `C-h'.
  201.      (keyboard-translate ?\C-? ?\C-h)
  202.  
  203.    Keyboard translations are not the same as key bindings in keymaps
  204. (*note Keymaps::.).  Emacs contains numerous keymaps that apply in
  205. different situations, but there is only one set of keyboard
  206. translations, and it applies to every character that Emacs reads from
  207. the terminal.  Keyboard translations take place at the lowest level of
  208. input processing; the keys that are looked up in keymaps contain the
  209. characters that result from keyboard translation.
  210.  
  211.    Under X, the keyboard key named DELETE is a function key and is
  212. distinct from the ASCII character named DEL.  *Note Named ASCII
  213. Chars::.  Keyboard translations affect only ASCII character input, not
  214. function keys; thus, the above example used under X does not affect the
  215. DELETE key.  However, the translation above isn't necessary under X,
  216. because Emacs can also distinguish between the BACKSPACE key and `C-h';
  217. and it normally treats BACKSPACE as DEL.
  218.  
  219.    For full information about how to use keyboard translations, see
  220. *Note Translating Input: (elisp)Translating Input.
  221.  
  222. 
  223. File: emacs,  Node: Syntax,  Next: Init File,  Prev: Keyboard Translations,  Up: Customization
  224.  
  225. The Syntax Table
  226. ================
  227.  
  228.    All the Emacs commands which parse words or balance parentheses are
  229. controlled by the "syntax table".  The syntax table says which
  230. characters are opening delimiters, which are parts of words, which are
  231. string quotes, and so on.  Each major mode has its own syntax table
  232. (though sometimes related major modes use the same one) which it
  233. installs in each buffer that uses that major mode.  The syntax table
  234. installed in the current buffer is the one that all commands use, so we
  235. call it "the" syntax table.  A syntax table is a Lisp object, a vector
  236. of length 256 whose elements are numbers.
  237.  
  238.    To display a description of the contents of the current syntax table,
  239. type `C-h s' (`describe-syntax').  The description of each character
  240. includes both the string you would have to give to
  241. `modify-syntax-entry' to set up that character's current syntax, and
  242. some English to explain that string if necessary.
  243.  
  244.    For full information on the syntax table, see *Note Syntax Tables:
  245. (elisp)Syntax Tables.
  246.  
  247. 
  248. File: emacs,  Node: Init File,  Prev: Syntax,  Up: Customization
  249.  
  250. The Init File, `~/.emacs'
  251. =========================
  252.  
  253.    When Emacs is started, it normally loads a Lisp program from the file
  254. `.emacs' in your home directory.  We call this file your "init file"
  255. because it specifies how to initialize Emacs for you.  You can use the
  256. command line switches `-q' and `-u' to tell Emacs whether to load an
  257. init file, and which one (*note Entering Emacs::.).
  258.  
  259.    There can also be a "default init file", which is the library named
  260. `default.el', found via the standard search path for libraries.  The
  261. Emacs distribution contains no such library; your site may create one
  262. for local customizations.  If this library exists, it is loaded
  263. whenever you start Emacs (except when you specify `-q').  But your init
  264. file, if any, is loaded first; if it sets `inhibit-default-init'
  265. non-`nil', then `default' is not loaded.
  266.  
  267.    Your site may also have a "site startup file"; this is named
  268. `site-start.el', if it exists.  Emacs loads this library before it
  269. loads your init file.  To inhibit loading of this library, use the
  270. option `-no-site-file'.
  271.  
  272.    If you have a large amount of code in your `.emacs' file, you should
  273. move it into another file such as `~/SOMETHING.el', byte-compile it,
  274. and make your `.emacs' file load it with `(load "~/SOMETHING")'.  *Note
  275. Byte Compilation: (elisp)Byte Compilation, for more information about
  276. compiling Emacs Lisp programs.
  277.  
  278. * Menu:
  279.  
  280. * Init Syntax::         Syntax of constants in Emacs Lisp.
  281. * Init Examples::    How to do some things with an init file.
  282. * Terminal Init::    Each terminal type can have an init file.
  283. * Find Init::         How Emacs finds the init file.
  284.  
  285. 
  286. File: emacs,  Node: Init Syntax,  Next: Init Examples,  Up: Init File
  287.  
  288. Init File Syntax
  289. ----------------
  290.  
  291.    The `.emacs' file contains one or more Lisp function call
  292. expressions.  Each of these consists of a function name followed by
  293. arguments, all surrounded by parentheses.  For example, `(setq
  294. fill-column 60)' calls the function `setq' to set the variable
  295. `fill-column' (*note Filling::.) to 60.
  296.  
  297.    The second argument to `setq' is an expression for the new value of
  298. the variable.  This can be a constant, a variable, or a function call
  299. expression.  In `.emacs', constants are used most of the time.  They
  300. can be:
  301.  
  302. Numbers:
  303.      Numbers are written in decimal, with an optional initial minus
  304.      sign.
  305.  
  306. Strings:
  307.      Lisp string syntax is the same as C string syntax with a few extra
  308.      features.  Use a double-quote character to begin and end a string
  309.      constant.
  310.  
  311.      In a string, you can include newlines and special characters
  312.      literally.  But often it is cleaner to use backslash sequences for
  313.      them: `\n' for newline, `\b' for backspace, `\r' for carriage
  314.      return, `\t' for tab, `\f' for formfeed (control-L), `\e' for
  315.      escape, `\\' for a backslash, `\"' for a double-quote, or `\OOO'
  316.      for the character whose octal code is OOO.  Backslash and
  317.      double-quote are the only characters for which backslash sequences
  318.      are mandatory.
  319.  
  320.      `\C-' can be used as a prefix for a control character, as in
  321.      `\C-s' for ASCII control-S, and `\M-' can be used as a prefix for
  322.      a Meta character, as in `\M-a' for `Meta-A' or `\M-\C-a' for
  323.      `Control-Meta-A'.
  324.  
  325. Characters:
  326.      Lisp character constant syntax consists of a `?' followed by
  327.      either a character or an escape sequence starting with `\'.
  328.      Examples: `?x', `?\n', `?\"', `?\)'.  Note that strings and
  329.      characters are not interchangeable in Lisp; some contexts require
  330.      one and some contexts require the other.
  331.  
  332. True:
  333.      `t' stands for `true'.
  334.  
  335. False:
  336.      `nil' stands for `false'.
  337.  
  338. Other Lisp objects:
  339.      Write a single-quote (') followed by the Lisp object you want.
  340.  
  341. 
  342. File: emacs,  Node: Init Examples,  Next: Terminal Init,  Prev: Init Syntax,  Up: Init File
  343.  
  344. Init File Examples
  345. ------------------
  346.  
  347.    Here are some examples of doing certain commonly desired things with
  348. Lisp expressions:
  349.  
  350.    * Make TAB in C mode just insert a tab if point is in the middle of a
  351.      line.
  352.  
  353.           (setq c-tab-always-indent nil)
  354.  
  355.      Here we have a variable whose value is normally `t' for `true' and
  356.      the alternative is `nil' for `false'.
  357.  
  358.    * Make searches case sensitive by default (in all buffers that do not
  359.      override this).
  360.  
  361.           (setq-default case-fold-search nil)
  362.  
  363.      This sets the default value, which is effective in all buffers
  364.      that do not have local values for the variable.  Setting
  365.      `case-fold-search' with `setq' affects only the current buffer's
  366.      local value, which is not what you probably want to do in an init
  367.      file.
  368.  
  369.    * Specify your own email address, if Emacs can't figure it out
  370.      correctly.
  371.  
  372.           (setq user-mail-address "coon@yoyodyne.com")
  373.  
  374.      Various Emacs packages that need your own email address use the
  375.      value of `user-mail-address'.
  376.  
  377.    * Make Text mode the default mode for new buffers.
  378.  
  379.           (setq default-major-mode 'text-mode)
  380.  
  381.      Note that `text-mode' is used because it is the command for
  382.      entering Text mode.  The single-quote before it makes the symbol a
  383.      constant; otherwise, `text-mode' would be treated as a variable
  384.      name.
  385.  
  386.    * Turn on Auto Fill mode automatically in Text mode and related
  387.      modes.
  388.  
  389.           (add-hook 'text-mode-hook
  390.             '(lambda () (auto-fill-mode 1)))
  391.  
  392.      This shows how to add a hook function to a normal hook variable
  393.      (*note Hooks::.).  The function we supply is a list starting with
  394.      `lambda', with a single-quote in front of it to make it a list
  395.      constant rather than an expression.
  396.  
  397.      It's beyond the scope of this manual to explain Lisp functions,
  398.      but for this example it is enough to know that the effect is to
  399.      execute `(auto-fill-mode 1)' when Text mode is entered.  You can
  400.      replace that with any other expression that you like, or with
  401.      several expressions in a row.
  402.  
  403.      Emacs comes with a function named `turn-on-auto-fill' whose
  404.      definition is `(lambda () (auto-fill-mode 1))'.  Thus, a simpler
  405.      way to write the above example is as follows:
  406.  
  407.           (add-hook 'text-mode-hook 'turn-on-auto-fill)
  408.  
  409.    * Load the installed Lisp library named `foo' (actually a file
  410.      `foo.elc' or `foo.el' in a standard Emacs directory).
  411.  
  412.           (load "foo")
  413.  
  414.      When the argument to `load' is a relative file name, not starting
  415.      with `/' or `~', `load' searches the directories in `load-path'
  416.      (*note Lisp Libraries::.).
  417.  
  418.    * Load the compiled Lisp file `foo.elc' from your home directory.
  419.  
  420.           (load "~/foo.elc")
  421.  
  422.      Here an absolute file name is used, so no searching is done.
  423.  
  424.    * Rebind the key `C-x l' to run the function `make-symbolic-link'.
  425.  
  426.           (global-set-key "\C-xl" 'make-symbolic-link)
  427.  
  428.      or
  429.  
  430.           (define-key global-map "\C-xl" 'make-symbolic-link)
  431.  
  432.      Note once again the single-quote used to refer to the symbol
  433.      `make-symbolic-link' instead of its value as a variable.
  434.  
  435.    * Do the same thing for C mode only.
  436.  
  437.           (define-key c-mode-map "\C-xl" 'make-symbolic-link)
  438.  
  439.    * Redefine all keys which now run `next-line' in Fundamental mode so
  440.      that they run `forward-line' instead.
  441.  
  442.           (substitute-key-definition 'next-line 'forward-line
  443.                                      global-map)
  444.  
  445.    * Make `C-x C-v' undefined.
  446.  
  447.           (global-unset-key "\C-x\C-v")
  448.  
  449.      One reason to undefine a key is so that you can make it a prefix.
  450.      Simply defining `C-x C-v ANYTHING' will make `C-x C-v' a prefix,
  451.      but `C-x C-v' must first be freed of its usual non-prefix
  452.      definition.
  453.  
  454.    * Make `$' have the syntax of punctuation in Text mode.  Note the
  455.      use of a character constant for `$'.
  456.  
  457.           (modify-syntax-entry ?\$ "." text-mode-syntax-table)
  458.  
  459.    * Enable the use of the command `eval-expression' without
  460.      confirmation.
  461.  
  462.           (put 'eval-expression 'disabled nil)
  463.  
  464. 
  465. File: emacs,  Node: Terminal Init,  Next: Find Init,  Prev: Init Examples,  Up: Init File
  466.  
  467. Terminal-specific Initialization
  468. --------------------------------
  469.  
  470.    Each terminal type can have a Lisp library to be loaded into Emacs
  471. when it is run on that type of terminal.  For a terminal type named
  472. TERMTYPE, the library is called `term/TERMTYPE' and it is found by
  473. searching the directories `load-path' as usual and trying the suffixes
  474. `.elc' and `.el'.  Normally it appears in the subdirectory `term' of
  475. the directory where most Emacs libraries are kept.
  476.  
  477.    The usual purpose of the terminal-specific library is to map the
  478. escape sequences used by the terminal's function keys onto more
  479. meaningful names, using `function-key-map'.  See the file
  480. `term/lk201.el' for an example of how this is done.  Many function keys
  481. are mapped automatically according to the information in the Termcap
  482. data base; the terminal-specific library needs to map only the function
  483. keys that Termcap does not specify.
  484.  
  485.    When the terminal type contains a hyphen, only the part of the name
  486. before the first hyphen is significant in choosing the library name.
  487. Thus, terminal types `aaa-48' and `aaa-30-rv' both use the library
  488. `term/aaa'.  The code in the library can use `(getenv "TERM")' to find
  489. the full terminal type name.
  490.  
  491.    The library's name is constructed by concatenating the value of the
  492. variable `term-file-prefix' and the terminal type.  Your `.emacs' file
  493. can prevent the loading of the terminal-specific library by setting
  494. `term-file-prefix' to `nil'.
  495.  
  496.    Emacs runs the hook `term-setup-hook' at the end of initialization,
  497. after both your `.emacs' file and any terminal-specific library have
  498. been read in.  Add hook functions to this hook if you wish to override
  499. part of any of the terminal-specific libraries and to define
  500. initializations for terminals that do not have a library.  *Note
  501. Hooks::.
  502.  
  503. 
  504. File: emacs,  Node: Find Init,  Prev: Terminal Init,  Up: Init File
  505.  
  506. How Emacs Finds Your Init File
  507. ------------------------------
  508.  
  509.    Normally Emacs uses the environment variable `HOME' to find
  510. `.emacs'; that's what `~' means in a file name.  But if you have done
  511. `su', Emacs tries to find your own `.emacs', not that of the user you
  512. are currently pretending to be.  The idea is that you should get your
  513. own editor customizations even if you are running as the super user.
  514.  
  515.    More precisely, Emacs first determines which user's init file to use.
  516. It gets the user name from the environment variables `LOGNAME' and
  517. `USER'; if neither of those exists, it uses effective user-ID.  If that
  518. user name matches the real user-ID, then Emacs uses `HOME'; otherwise,
  519. it looks up the home directory corresponding to that user name in the
  520. system's data base of users.
  521.  
  522. 
  523. File: emacs,  Node: Quitting,  Next: Lossage,  Prev: Customization,  Up: Top
  524.  
  525. Quitting and Aborting
  526. =====================
  527.  
  528. `C-g'
  529.      Quit.  Cancel running or partially typed command.
  530.  
  531. `C-]'
  532.      Abort innermost recursive editing level and cancel the command
  533.      which invoked it (`abort-recursive-edit').
  534.  
  535. `ESC ESC ESC'
  536.      Either quit or abort, whichever makes sense
  537.      (`keyboard-escape-quit').
  538.  
  539. `M-x top-level'
  540.      Abort all recursive editing levels that are currently executing.
  541.  
  542. `C-x u'
  543.      Cancel a previously made change in the buffer contents (`undo').
  544.  
  545.    There are two ways of canceling commands which are not finished
  546. executing: "quitting" with `C-g', and "aborting" with `C-]' or `M-x
  547. top-level'.  Quitting cancels a partially typed command or one which is
  548. already running.  Aborting exits a recursive editing level and cancels
  549. the command that invoked the recursive edit.  (*Note Recursive Edit::.)
  550.  
  551.    Quitting with `C-g' is used for getting rid of a partially typed
  552. command, or a numeric argument that you don't want.  It also stops a
  553. running command in the middle in a relatively safe way, so you can use
  554. it if you accidentally give a command which takes a long time.  In
  555. particular, it is safe to quit out of killing; either your text will
  556. *all* still be in the buffer, or it will *all* be in the kill ring (or
  557. maybe both).  Quitting an incremental search does special things
  558. documented under searching; in general, it may take two successive
  559. `C-g' characters to get out of a search (*note Incremental Search::.).
  560.  
  561.    `C-g' works by setting the variable `quit-flag' to `t' the instant
  562. `C-g' is typed; Emacs Lisp checks this variable frequently and quits if
  563. it is non-`nil'.  `C-g' is only actually executed as a command if you
  564. type it while Emacs is waiting for input.
  565.  
  566.    If you quit with `C-g' a second time before the first `C-g' is
  567. recognized, you activate the "emergency escape" feature and return to
  568. the shell.  *Note Emergency Escape::.
  569.  
  570.    There may be times when you cannot quit.  When Emacs is waiting for
  571. the operating system to do something, quitting is impossible unless
  572. special pains are taken for the particular system call within Emacs
  573. where the waiting occurs.  We have done this for the system calls that
  574. users are likely to want to quit from, but it's possible you will find
  575. another.  In one very common case--waiting for file input or output
  576. using NFS--Emacs itself knows how to quit, but most NFS implementations
  577. simply do not allow user programs to stop waiting for NFS when the NFS
  578. server is hung.
  579.  
  580.    Aborting with `C-]' (`abort-recursive-edit') is used to get out of a
  581. recursive editing level and cancel the command which invoked it.
  582. Quitting with `C-g' does not do this, and could not do this, because it
  583. is used to cancel a partially typed command *within* the recursive
  584. editing level.  Both operations are useful.  For example, if you are in
  585. a recursive edit and type `C-u 8' to enter a numeric argument, you can
  586. cancel that argument with `C-g' and remain in the recursive edit.
  587.  
  588.    The command `ESC ESC ESC' (`keyboard-escape-quit') can either quit
  589. or abort.  This key was defined because ESC is used to "get out" in
  590. many PC programs.  It can cancel a prefix argument, clear a selected
  591. region, or get out of a Query Replace, like `C-g'.  It can get out of
  592. the minibuffer or a recursive edit, like `C-]'.  It can also get out of
  593. splitting the frame into multiple windows, like `C-x 1'.  One thing it
  594. cannot do, however, is stop a command that is running.  That's because
  595. it executes as an ordinary command, and Emacs doesn't notice it until
  596. it is ready for a command.
  597.  
  598.    The command `M-x top-level' is equivalent to "enough" `C-]' commands
  599. to get you out of all the levels of recursive edits that you are in.
  600. `C-]' gets you out one level at a time, but `M-x top-level' goes out
  601. all levels at once.  Both `C-]' and `M-x top-level' are like all other
  602. commands, and unlike `C-g', in that they take effect only when Emacs is
  603. ready for a command.  `C-]' is an ordinary key and has its meaning only
  604. because of its binding in the keymap.  *Note Recursive Edit::.
  605.  
  606.    `C-x u' (`undo') is not strictly speaking a way of canceling a
  607. command, but you can think of it as canceling a command that already
  608. finished executing.  *Note Undo::.
  609.  
  610. 
  611. File: emacs,  Node: Lossage,  Next: Bugs,  Prev: Quitting,  Up: Top
  612.  
  613. Dealing with Emacs Trouble
  614. ==========================
  615.  
  616.    This section describes various conditions in which Emacs fails to
  617. work normally, and how to recognize them and correct them.
  618.  
  619. * Menu:
  620.  
  621. * DEL Gets Help::       What to do if DEL doesn't delete.
  622. * Stuck Recursive::     `[...]' in mode line around the parentheses.
  623. * Screen Garbled::      Garbage on the screen.
  624. * Text Garbled::        Garbage in the text.
  625. * Unasked-for Search::  Spontaneous entry to incremental search.
  626. * Memory Full::         How to cope when you run out of memory.
  627. * Emergency Escape::    Emergency escape--
  628.                           What to do if Emacs stops responding.
  629. * Total Frustration::   When you are at your wits' end.
  630.  
  631. 
  632. File: emacs,  Node: DEL Gets Help,  Next: Stuck Recursive,  Up: Lossage
  633.  
  634. If DEL Fails to Delete
  635. ----------------------
  636.  
  637.    If you find that DEL enters Help like `Control-h' instead of
  638. deleting a character, your terminal is sending the wrong code for DEL.
  639. You can work around this problem by changing the keyboard translation
  640. table (*note Keyboard Translations::.).
  641.  
  642. 
  643. File: emacs,  Node: Stuck Recursive,  Next: Screen Garbled,  Prev: DEL Gets Help,  Up: Lossage
  644.  
  645. Recursive Editing Levels
  646. ------------------------
  647.  
  648.    Recursive editing levels are important and useful features of Emacs,
  649. but they can seem like malfunctions to the user who does not understand
  650. them.
  651.  
  652.    If the mode line has square brackets `[...]' around the parentheses
  653. that contain the names of the major and minor modes, you have entered a
  654. recursive editing level.  If you did not do this on purpose, or if you
  655. don't understand what that means, you should just get out of the
  656. recursive editing level.  To do so, type `M-x top-level'.  This is
  657. called getting back to top level.  *Note Recursive Edit::.
  658.  
  659. 
  660. File: emacs,  Node: Screen Garbled,  Next: Text Garbled,  Prev: Stuck Recursive,  Up: Lossage
  661.  
  662. Garbage on the Screen
  663. ---------------------
  664.  
  665.    If the data on the screen looks wrong, the first thing to do is see
  666. whether the text is really wrong.  Type `C-l', to redisplay the entire
  667. screen.  If the screen appears correct after this, the problem was
  668. entirely in the previous screen update.  (Otherwise, see *Note Text
  669. Garbled::.)
  670.  
  671.    Display updating problems often result from an incorrect termcap
  672. entry for the terminal you are using.  The file `etc/TERMS' in the Emacs
  673. distribution gives the fixes for known problems of this sort.
  674. `INSTALL' contains general advice for these problems in one of its
  675. sections.  Very likely there is simply insufficient padding for certain
  676. display operations.  To investigate the possibility that you have this
  677. sort of problem, try Emacs on another terminal made by a different
  678. manufacturer.  If problems happen frequently on one kind of terminal
  679. but not another kind, it is likely to be a bad termcap entry, though it
  680. could also be due to a bug in Emacs that appears for terminals that
  681. have or that lack specific features.
  682.  
  683. 
  684. File: emacs,  Node: Text Garbled,  Next: Unasked-for Search,  Prev: Screen Garbled,  Up: Lossage
  685.  
  686. Garbage in the Text
  687. -------------------
  688.  
  689.    If `C-l' shows that the text is wrong, try undoing the changes to it
  690. using `C-x u' until it gets back to a state you consider correct.  Also
  691. try `C-h l' to find out what command you typed to produce the observed
  692. results.
  693.  
  694.    If a large portion of text appears to be missing at the beginning or
  695. end of the buffer, check for the word `Narrow' in the mode line.  If it
  696. appears, the text you don't see is probably still present, but
  697. temporarily off-limits.  To make it accessible again, type `C-x n w'.
  698. *Note Narrowing::.
  699.  
  700. 
  701. File: emacs,  Node: Unasked-for Search,  Next: Memory Full,  Prev: Text Garbled,  Up: Lossage
  702.  
  703. Spontaneous Entry to Incremental Search
  704. ---------------------------------------
  705.  
  706.    If Emacs spontaneously displays `I-search:' at the bottom of the
  707. screen, it means that the terminal is sending `C-s' and `C-q' according
  708. to the poorly designed xon/xoff "flow control" protocol.
  709.  
  710.    If this happens to you, your best recourse is to put the terminal in
  711. a mode where it will not use flow control, or give it so much padding
  712. that it will never send a `C-s'.  (One way to increase the amount of
  713. padding is to set the variable `baud-rate' to a larger value.  Its
  714. value is the terminal output speed, measured in the conventional units
  715. of baud.)
  716.  
  717.    If you don't succeed in turning off flow control, the next best thing
  718. is to tell Emacs to cope with it.  To do this, call the function
  719. `enable-flow-control'.
  720.  
  721.    Typically there are particular terminal types with which you must use
  722. flow control.  You can conveniently ask for flow control on those
  723. terminal types only, using `enable-flow-control-on'.  For example, if
  724. you find you must use flow control on VT-100 and H19 terminals, put the
  725. following in your `.emacs' file:
  726.  
  727.      (enable-flow-control-on "vt100" "h19")
  728.  
  729.    When flow control is enabled, you must type `C-\' to get the effect
  730. of a `C-s', and type `C-^' to get the effect of a `C-q'.  (These
  731. aliases work by means of keyboard translations; see *Note Keyboard
  732. Translations::.)
  733.  
  734. 
  735. File: emacs,  Node: Memory Full,  Next: Emergency Escape,  Prev: Unasked-for Search,  Up: Lossage
  736.  
  737. Running out of Memory
  738. ---------------------
  739.  
  740.    If you get the error message `Virtual memory exceeded', save your
  741. modified buffers with `C-x s'.  This method of saving them has the
  742. smallest need for additional memory.  Emacs keeps a reserve of memory
  743. which it makes available when this error happens; that should be enough
  744. to enable `C-x s' to complete its work.
  745.  
  746.    Once you have saved your modified buffers, you can exit this Emacs
  747. job and start another, or you can use `M-x kill-some-buffers' to free
  748. space in the current Emacs job.  If you kill buffers containing a
  749. substantial amount of text, you can safely go on editing.  Emacs refills
  750. its memory reserve automatically when it sees sufficient free space
  751. available, in case you run out of memory another time.
  752.  
  753.    Do not use `M-x buffer-menu' to save or kill buffers when you run
  754. out of memory, because the buffer menu needs a fair amount memory
  755. itself, and the reserve supply may not be enough.
  756.  
  757. 
  758. File: emacs,  Node: Emergency Escape,  Next: Total Frustration,  Prev: Memory Full,  Up: Lossage
  759.  
  760. Emergency Escape
  761. ----------------
  762.  
  763.    Because at times there have been bugs causing Emacs to loop without
  764. checking `quit-flag', a special feature causes Emacs to be suspended
  765. immediately if you type a second `C-g' while the flag is already set,
  766. so you can always get out of GNU Emacs.  Normally Emacs recognizes and
  767. clears `quit-flag' (and quits!) quickly enough to prevent this from
  768. happening.
  769.  
  770.    When you resume Emacs after a suspension caused by multiple `C-g', it
  771. asks two questions before going back to what it had been doing:
  772.  
  773.      Auto-save? (y or n)
  774.      Abort (and dump core)? (y or n)
  775.  
  776. Answer each one with `y' or `n' followed by RET.
  777.  
  778.    Saying `y' to `Auto-save?' causes immediate auto-saving of all
  779. modified buffers in which auto-saving is enabled.
  780.  
  781.    Saying `y' to `Abort (and dump core)?' causes an illegal instruction
  782. to be executed, dumping core.  This is to enable a wizard to figure out
  783. why Emacs was failing to quit in the first place.  Execution does not
  784. continue after a core dump.  If you answer `n', execution does
  785. continue.  With luck, GNU Emacs will ultimately check `quit-flag' and
  786. quit normally.  If not, and you type another `C-g', it is suspended
  787. again.
  788.  
  789.    If Emacs is not really hung, just slow, you may invoke the double
  790. `C-g' feature without really meaning to.  Then just resume and answer
  791. `n' to both questions, and you will arrive at your former state.
  792. Presumably the quit you requested will happen soon.
  793.  
  794.    The double-`C-g' feature is turned off when Emacs is running under
  795. the X Window System, since you can use the window manager to kill Emacs
  796. or to create another window and run another program.
  797.  
  798. 
  799. File: emacs,  Node: Total Frustration,  Prev: Emergency Escape,  Up: Lossage
  800.  
  801. Help for Total Frustration
  802. --------------------------
  803.  
  804.    If using Emacs (or something else) becomes terribly frustrating and
  805. none of the techniques described above solve the problem, Emacs can
  806. still help you.
  807.  
  808.    First, if the Emacs you are using is not responding to commands, type
  809. `C-g C-g' to get out of it and then start a new one.
  810.  
  811.    Second, type `M-x doctor RET'.
  812.  
  813.    The doctor will help you feel better.  Each time you say something to
  814. the doctor, you must end it by typing RET RET.  This lets the doctor
  815. know you are finished.
  816.  
  817. 
  818. File: emacs,  Node: Bugs,  Next: Service,  Prev: Lossage,  Up: Top
  819.  
  820. Reporting Bugs
  821. ==============
  822.  
  823.    Sometimes you will encounter a bug in Emacs.  Although we cannot
  824. promise we can or will fix the bug, and we might not even agree that it
  825. is a bug, we want to hear about problems you encounter.  Often we agree
  826. they are bugs and want to fix them.
  827.  
  828.    To make it possible for us to fix a bug, you must report it.  In
  829. order to do so effectively, you must know when and how to do it.
  830.  
  831. * Menu:
  832.  
  833. * Criteria:  Bug Criteria.     Have you really found a bug?
  834. * Understanding Bug Reporting::     How to report a bug effectively.
  835. * Checklist::             Steps to follow for a good bug report.
  836. * Sending Patches::         How to send a patch for GNU Emacs.
  837.  
  838. 
  839. File: emacs,  Node: Bug Criteria,  Next: Understanding Bug Reporting,  Up: Bugs
  840.  
  841. When Is There a Bug
  842. -------------------
  843.  
  844.    If Emacs executes an illegal instruction, or dies with an operating
  845. system error message that indicates a problem in the program (as
  846. opposed to something like "disk full"), then it is certainly a bug.
  847.  
  848.    If Emacs updates the display in a way that does not correspond to
  849. what is in the buffer, then it is certainly a bug.  If a command seems
  850. to do the wrong thing but the problem corrects itself if you type
  851. `C-l', it is a case of incorrect display updating.
  852.  
  853.    Taking forever to complete a command can be a bug, but you must make
  854. certain that it was really Emacs's fault.  Some commands simply take a
  855. long time.  Type `C-g' and then `C-h l' to see whether the input Emacs
  856. received was what you intended to type; if the input was such that you
  857. *know* it should have been processed quickly, report a bug.  If you
  858. don't know whether the command should take a long time, find out by
  859. looking in the manual or by asking for assistance.
  860.  
  861.    If a command you are familiar with causes an Emacs error message in a
  862. case where its usual definition ought to be reasonable, it is probably a
  863. bug.
  864.  
  865.    If a command does the wrong thing, that is a bug.  But be sure you
  866. know for certain what it ought to have done.  If you aren't familiar
  867. with the command, or don't know for certain how the command is supposed
  868. to work, then it might actually be working right.  Rather than jumping
  869. to conclusions, show the problem to someone who knows for certain.
  870.  
  871.    Finally, a command's intended definition may not be best for editing
  872. with.  This is a very important sort of problem, but it is also a
  873. matter of judgment.  Also, it is easy to come to such a conclusion out
  874. of ignorance of some of the existing features.  It is probably best not
  875. to complain about such a problem until you have checked the
  876. documentation in the usual ways, feel confident that you understand it,
  877. and know for certain that what you want is not available.  If you are
  878. not sure what the command is supposed to do after a careful reading of
  879. the manual, check the index and glossary for any terms that may be
  880. unclear.
  881.  
  882.    If after careful rereading of the manual you still do not understand
  883. what the command should do, that indicates a bug in the manual, which
  884. you should report.  The manual's job is to make everything clear to
  885. people who are not Emacs experts--including you.  It is just as
  886. important to report documentation bugs as program bugs.
  887.  
  888.    If the on-line documentation string of a function or variable
  889. disagrees with the manual, one of them must be wrong; that is a bug.
  890.  
  891. 
  892. File: emacs,  Node: Understanding Bug Reporting,  Next: Checklist,  Prev: Bug Criteria,  Up: Bugs
  893.  
  894. Understanding Bug Reporting
  895. ---------------------------
  896.  
  897.    When you decide that there is a bug, it is important to report it
  898. and to report it in a way which is useful.  What is most useful is an
  899. exact description of what commands you type, starting with the shell
  900. command to run Emacs, until the problem happens.
  901.  
  902.    The most important principle in reporting a bug is to report *facts*,
  903. not hypotheses or categorizations.  It is always easier to report the
  904. facts, but people seem to prefer to strain to posit explanations and
  905. report them instead.  If the explanations are based on guesses about
  906. how Emacs is implemented, they will be useless; we will have to try to
  907. figure out what the facts must have been to lead to such speculations.
  908. Sometimes this is impossible.  But in any case, it is unnecessary work
  909. for us.
  910.  
  911.    For example, suppose that you type `C-x C-f /glorp/baz.ugh RET',
  912. visiting a file which (you know) happens to be rather large, and Emacs
  913. prints out `I feel pretty today'.  The best way to report the bug is
  914. with a sentence like the preceding one, because it gives all the facts
  915. and nothing but the facts.
  916.  
  917.    Do not assume that the problem is due to the size of the file and
  918. say, "When I visit a large file, Emacs prints out `I feel pretty
  919. today'." This is what we mean by "guessing explanations".  The problem
  920. is just as likely to be due to the fact that there is a `z' in the file
  921. name.  If this is so, then when we got your report, we would try out
  922. the problem with some "large file", probably with no `z' in its name,
  923. and not find anything wrong.  There is no way in the world that we
  924. could guess that we should try visiting a file with a `z' in its name.
  925.  
  926.    Alternatively, the problem might be due to the fact that the file
  927. starts with exactly 25 spaces.  For this reason, you should make sure
  928. that you inform us of the exact contents of any file that is needed to
  929. reproduce the bug.  What if the problem only occurs when you have typed
  930. the `C-x C-a' command previously?  This is why we ask you to give the
  931. exact sequence of characters you typed since starting the Emacs session.
  932.  
  933.    You should not even say "visit a file" instead of `C-x C-f' unless
  934. you *know* that it makes no difference which visiting command is used.
  935. Similarly, rather than saying "if I have three characters on the line,"
  936. say "after I type `RET A B C RET C-p'," if that is the way you entered
  937. the text.
  938.  
  939.